#ifndef  FAN_H
#define  FAN_H
#include "stm32f1xx_hal.h"
#include "bsp_gpio.h"
#include "bsp_tim.h"

#define FAN_STOP()      do{HAL_GPIO_WritePin(TB6612_AIN1_GPIO_PORT,TB6612_AIN1_GPIO_PIN,GPIO_PIN_SET);\
                            HAL_GPIO_WritePin(TB6612_AIN2_GPIO_PORT,TB6612_AIN2_GPIO_PIN,GPIO_PIN_SET);}while(0)
#define FAN_START()     do{HAL_GPIO_WritePin(TB6612_AIN1_GPIO_PORT,TB6612_AIN1_GPIO_PIN,GPIO_PIN_SET);\
                            HAL_GPIO_WritePin(TB6612_AIN2_GPIO_PORT,TB6612_AIN2_GPIO_PIN,GPIO_PIN_RESET);}while(0)

typedef enum _FAN_SPEED_{
    FAN_SPEED_LEVEL_0 = 0, // 0%
    FAN_SPEED_LEVEL_1, // 10%
    FAN_SPEED_LEVEL_2, // 20%
    FAN_SPEED_LEVEL_3, // 30%
    FAN_SPEED_LEVEL_4, // 40%
    FAN_SPEED_LEVEL_5, // 50%
    FAN_SPEED_LEVEL_6, // 60%
    FAN_SPEED_LEVEL_7, // 70%
    FAN_SPEED_LEVEL_8, // 80%
    FAN_SPEED_LEVEL_9, // 90%
    FAN_SPEED_LEVEL_10, // 100%
}FAN_SPEED;

typedef enum __FAN_STATE_{
    FAN_STATE_OFF = 0, // 风扇关闭
    FAN_STATE_ON, // 风扇开启 
}FAN_STATE;

void Set_Fan_Speed(FAN_SPEED speed);
void Set_Fan_State(FAN_STATE state);
#endif // ! FAN_H
